<template>
  <div class="xgrqbq" v-if="isOK">
    <div class="box">
      <span
        style="
          display: inline-block;
          width: 20%;
          text-align: right;
          vertical-align: middle;
        "
        >公卫人群：</span
      >
      <el-checkbox-group
        v-model="info.groupType"
        style="display: inline-block; width: 80%; vertical-align: middle"
      >
        <el-checkbox label="1">普通居民</el-checkbox>
        <el-checkbox label="2">0～6岁儿童</el-checkbox>
        <el-checkbox label="4">孕产妇</el-checkbox>
        <el-checkbox label="8">65岁及以上老年人</el-checkbox>
        <el-checkbox label="16">高血压患者</el-checkbox>
        <el-checkbox label="32">2型糖尿病患者</el-checkbox>
        <el-checkbox label="64">严重精神障碍患者</el-checkbox>
        <el-checkbox label="128">肺结核患者</el-checkbox>
      </el-checkbox-group>
    </div>
    <div class="box" v-if="false">
      <span
        style="
          display: inline-block;
          width: 20%;
          text-align: right;
          vertical-align: middle;
        "
        >居民标签：</span
      >
      <el-checkbox-group
        v-model="info.residentType"
        style="display: inline-block; width: 80%; vertical-align: middle"
      >
        <el-checkbox label="1">一般人</el-checkbox>
        <el-checkbox label="2">残疾人</el-checkbox>
        <el-checkbox label="3">计划生育特殊家庭成员</el-checkbox>
        <el-checkbox label="4">城市低保</el-checkbox>
        <el-checkbox label="5">建档立卡贫困人员</el-checkbox>
        <el-checkbox label="6">五保户</el-checkbox>
        <el-checkbox label="7">边缘易致贫户</el-checkbox>
        <el-checkbox label="8">突发严重困难户</el-checkbox>
        <el-checkbox label="9">脱贫不稳定户</el-checkbox>
        <el-checkbox label="10">农村特困</el-checkbox>
        <el-checkbox label="11">困难产业工人</el-checkbox>
        <el-checkbox label="12">城市特困</el-checkbox>
        <el-checkbox label="13">农村低保</el-checkbox>
      </el-checkbox-group>
    </div>
    <div class="box">
      <span
        style="
          display: inline-block;
          width: 20%;
          text-align: right;
          vertical-align: middle;
        "
        >慢病标签：</span
      >
      <el-checkbox-group
        v-model="info.chronicType"
        style="display: inline-block; width: 80%; vertical-align: middle"
      >
        <el-checkbox label="冠心病">冠心病</el-checkbox>
        <el-checkbox label="慢阻肺">慢阻肺</el-checkbox>
        <el-checkbox label="高血压">高血压</el-checkbox>
        <el-checkbox label="糖尿病">糖尿病</el-checkbox>
        <el-checkbox label="脑卒中">脑卒中</el-checkbox>
        <el-checkbox label="慢性肾脏病">慢性肾脏病</el-checkbox>
        <el-checkbox label="肿瘤">肿瘤</el-checkbox>
        <el-checkbox label="微创介入">微创介入</el-checkbox>
      </el-checkbox-group>
    </div>
    <div class="box">
      <span
        style="
          display: inline-block;
          width: 20%;
          text-align: right;
          vertical-align: middle;
        "
        >高危标签：</span
      >
      <el-checkbox-group
        v-model="info.riskType"
        style="display: inline-block; width: 80%; vertical-align: middle"
      >
        <el-checkbox label="年龄">年龄</el-checkbox>
        <el-checkbox label="高血压">高血压</el-checkbox>
        <el-checkbox label="高血脂">高血脂</el-checkbox>
        <el-checkbox label="高血糖">高血糖</el-checkbox>
        <el-checkbox label="肥胖">肥胖</el-checkbox>
        <el-checkbox label="家族史">家族史</el-checkbox>
        <el-checkbox label="吸烟">吸烟</el-checkbox>
        <el-checkbox label="饮酒">饮酒</el-checkbox>
        <el-checkbox label="高盐饮食">高盐饮食</el-checkbox>
        <el-checkbox label="既往史">既往史</el-checkbox>
      </el-checkbox-group>
    </div>
    <!-- <div class="box">
      <span
        style="
          display: inline-block;
          width: 20%;
          text-align: right;
          vertical-align: middle;
        "
        >高血压患者纳入管理日期：</span
      >
      <span style="display: inline-block; width: 80%; vertical-align: middle">
        <el-date-picker v-model="value1" type="date" placeholder="选择日期">
        </el-date-picker>
        最近修改：2021-10-15 13:06:58
      </span>
    </div>
    <div class="tag_y">
      温馨提示： <br />
      当前居民，高血压首诊日期：2021-03-07，糖尿病首次随访日期：-
    </div> -->
    <div style="text-align: right; margin-top: 20px">
      <el-button type="primary" @click="btn_ok">提交</el-button>
    </div>
  </div>
</template>
              
              <script>
export default {
  data() {
    return {
      checkList: [],
      pickerOptions: {
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
        ],
      },
      value2: "",
      info: {},
      isOK: false,
    };
  },
  mounted() {
    this.getdata();
  },
  methods: {
    getdata() {
      this.isOK = false;
      var data = {
        idNo: localStorage.getItem("idCard"),
      };
      this.$post("/resident/list?idNo=" + data.idNo).then((res) => {
        this.info = res.data[0];
        this.info.groupType = this.info.groupType
          ? this.info.groupType.split(",")
          : [];
        this.info.residentType = this.info.residentType
          ? this.info.residentType.split(",")
          : [];
        this.info.chronicType = this.info.chronicType
          ? this.info.chronicType.split(",")
          : [];
        this.info.riskType = this.info.riskType
          ? this.info.riskType.split(",")
          : [];
        var body = {
          a: this.info.groupType,
          b: this.info.residentType,
          c: this.info.chronicType,
          d: this.info.riskType,
        };
        this.isOK = true;
      });
    },
    btn_ok() {
      var data = this.info;
      data.groupType = data.groupType.toString();
      data.residentType = data.residentType.toString();
      data.chronicType = data.chronicType.toString();
      data.riskType = data.riskType.toString();
      data.status = 0;
      this.$post("/resident/modify", data).then((res) => {
        this.$emit("passfunction", 1);
      });
    },
  },
};
</script>
              
              <style scoped lang="scss">
.xgrqbq {
  padding: 15px;
  .top {
    padding: 10px 20px;
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
  }
  .tab1 {
    tr {
      width: 100%;
      th {
        text-align: center;
        color: #000;
        background-color: rgb(250, 250, 250);
      }
      td {
        padding: 10px;
      }
    }
  }
  .box {
    padding: 15px;
    background-color: rgb(250, 250, 250);
    margin: 10px 0;
  }
}
.table_rd_pd {
  th,
  td {
    padding: 5px 10px;
  }
}
.tag_y {
  padding: 5px 10px;
  margin-top: 20px;
  background-color: #fffbe6;
  border: 1px solid #ffe58f;
}
</style>